package com.mjx.algorithm.oj;

import java.util.Scanner;

/**
 * Created by 梅京翔 on 2017 02 10下午 11:52.
 */
public class problem1207 {
    public static void main(String[] args) {
        int n;
        Scanner scanner = new Scanner(System.in);
        n = scanner.nextInt();
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = scanner.nextInt();
            if (array[i] < -2){
                System.out.println(String.format("%.2f",Math.pow(array[i],2) - Math.sin(array[i])));
            }
            else if (array[i] >= -2 && array[i] <=2){
                System.out.println(String.format("%.2f",Math.pow(2,array[i]) + array[i]));
            }
            else {
                System.out.println(String.format("%.2f",Math.sqrt(Math.pow(array[i],2) + array[i] + 1)));
            }
        }
    }
}
